<template>
  <div>
    <m-head title="我的收藏"></m-head>
    <div>
      <div class="item" v-for="(item, id) in list" v-bind:key="id" @click="$router.push('/articledetail')">
        <div class="info">
          <img :src="item.img" alt="" v-show="item.img">
          <h3>{{item.title}}</h3>
        </div>
        <p class="src">
          {{item.come}} <span>{{item.time}}</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import MHead from './MHeader'
import * as info from '../api/info'
export default {
  name: 'my-collection',
  components: {
    'm-head': MHead
  },
  data () {
    return {
      list: {}
    }
  },
  mounted () {
    this.getList()
  },
  methods: {
    getList () {
      info.getFavorites(1).then(res => {
        this.list = res.data
      })
    }
  }
}
</script>

<style scoped>
  .item{
    border-bottom: 10px solid #f1f1f1;
    padding: .3rem;
  }
  .info{
    display: flex;
    align-items: center;
    padding: .2rem 0;
  }
  .info img{
    width: 1.4rem;
    margin-right: .3rem;
  }
  .info h3{
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 7.9rem;
    font-size: .42rem;
    color: #000;
  }
  .item p{
    font-size: .32rem;
    color: #888;
  }
</style>

